.TH std::chrono::year_month::ok 3 "2024.06.10" "http://cppreference.com" "C++ Standard Libary"
.SH NAME
std::chrono::year_month::ok \- std::chrono::year_month::ok

.SH Synopsis
   constexpr bool ok() const noexcept;  \fI(since C++20)\fP

   Checks if the year and month values stored in this object are valid.

.SH Return value

   year().ok() && month().ok()

.SH Example


// Run this code

 #include <chrono>
 using namespace std::chrono_literals;

 int main()
 {
     constexpr std::chrono::year_month ym1{3030y, std::chrono::July};
     static_assert(ym1.ok());

     constexpr std::chrono::year_month ym2{std::chrono::year(2020)/16};
     static_assert(!ym2.ok());
 }
